]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appFavorites: Move installed-changed where it belongs
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 15 Apr 2026 21:09:00 +0000 (23:09 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 17 Apr 2026 14:40:53 +0000 (14:40 +0000)
In the dash we are monitoring the installed applications and reload the
favorites, while this is not something that is related to the dash per
se, and if the AppFavorites is used to track the favorites elsewhere it
would not be updated when new favorite apps are installed.

So move the logic to AppFavorites, that will now emit a changed
event whenever any favorite changed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4180>

js/ui/appFavorites.js
js/ui/dash.js

index a4ec6cb3010aa7c5a2e7550a119dc13b45780afe..d13a49066204c0084032c5443d142e3734cfb6d4 100644 (file)
@@ -12,6 +12,10 @@ class AppFavorites extends Signals.EventEmitter {
         this._parentalControlsManager.connect('app-filter-changed',
             () => this._updateFavorites());
 
+        this._appSystem = Shell.AppSystem.get_default();
+        this._appSystem.connect('installed-changed',
+            () => this._updateFavorites());
+
         this.FAVORITE_APPS_KEY = 'favorite-apps';
         this._favorites = {};
         global.settings.connect(`changed::${this.FAVORITE_APPS_KEY}`,
@@ -39,8 +43,7 @@ class AppFavorites extends Signals.EventEmitter {
 
     reload() {
         const ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
-        const appSys = Shell.AppSystem.get_default();
-        const apps = ids.map(id => appSys.lookup_app(id))
+        const apps = ids.map(id => this._appSystem.lookup_app(id))
                       .filter(app => app !== null && this._parentalControlsManager.shouldShowApp(app.app_info));
         this._favorites = {};
         for (let i = 0; i < apps.length; i++) {
index 9ebd348ee8a2b33e491aab03a6cc938b7628e013..1a0a841420eb08dcd776c538b6a016c00d93b34b 100644 (file)
@@ -379,10 +379,7 @@ export const Dash = GObject.registerClass({
 
         this._appSystem = Shell.AppSystem.get_default();
 
-        this._appSystem.connect('installed-changed', () => {
-            AppFavorites.getAppFavorites().reload();
-            this._queueRedisplay();
-        });
+        this._appSystem.connect('installed-changed', () => this._queueRedisplay());
         AppFavorites.getAppFavorites().connect('changed', this._queueRedisplay.bind(this));
         this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this));